<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <meta content='width=device-width, initial-scale=1.0' name='viewport'>
    <meta content='' name='description'>
    <meta content='Nils Nordman' name='author'>
    <link href='/images/howl.png' rel='shortcut icon'>
    <title>Howl :: Spec - howl.ui.CommandLine</title>
    <link href="/stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/syntax.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/howl.css" media="screen" rel="stylesheet" type="text/css" />
    <script src="https://code.jquery.com/jquery-1.12.3.min.js" type="text/javascript"></script>
    <script src="/javascripts/bootstrap.min.js" type="text/javascript"></script>
    
    <link href='//fonts.googleapis.com/css?family=Josefin+Slab' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Open+Sans+Condensed:700' rel='stylesheet' type='text/css'>
  </head>
  <body class='doc doc_spec doc_spec_ui doc_spec_ui_command_line_spec'>
    <div class='container'>
      <div class='masthead'>
        <ul class='nav nav-pills'>
          <li>
            <a href='/'>
              <span class='glyphicon glyphicon-home'></span>
              Home
            </a>
          </li>
          <li>
            <a href='/doc/'>
              <span class='glyphicon glyphicon-book'></span>
              Documentation
            </a>
          </li>
          <li>
            <a href='/blog/'>
              <span class='glyphicon glyphicon-bullhorn'></span>
              Blog
            </a>
          </li>
          <li>
            <a href='/contact.html'>
              <span class='glyphicon glyphicon-inbox'></span>
              Contact
            </a>
          </li>
        </ul>
      </div>
      <ol class="breadcrumb"><li><a href="/">Home</a></li><li><a href='../../'>Howl Documentation (master branch)</a></li><li>Spec</li><li>Ui</li><li>Spec - howl.ui.CommandLine</li></ol>
      <div class="spec-group spec-group-1">&#x000A;&#x000A;<h1 id="howl.ui.commandline">howl.ui.CommandLine</h1>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">command_line</span><span class="p">,</span><span class="w"> </span><span class="n">run_as_handler</span><span class="w">&#x000A;&#x000A;</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">f</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">wrapped</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">coroutine.wrap</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">f</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="k">return</span><span class="w"> </span><span class="n">wrapped</span><span class="o">!</span><span class="w">&#x000A;&#x000A;</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Window</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="p">.</span><span class="n">command_line</span><span class="w">&#x000A;  </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">f</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w">&#x000A;      </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'within-activity'</span><span class="w">&#x000A;      </span><span class="ss">handler:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">f</span><span class="o">!</span><span class="w">&#x000A;&#x000A;</span><span class="n">after_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">ok</span><span class="p">,</span><span class="w"> </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">pcall</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="p">.</span><span class="n">command_line</span><span class="o">\</span><span class="n">abort_all</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="k">if</span><span class="w"> </span><span class="ow">not</span><span class="w"> </span><span class="n">ok</span><span class="w">&#x000A;    </span><span class="nb">print</span><span class="w"> </span><span class="n">result</span><span class="w">&#x000A;  </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">nil</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">nil</span><span class="w">&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">nil</span></pre>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="command_line">command_line</h2>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id="\\run">\\run<span class="arg-list">(activity_spec)</span></h3>&#x000A;&#x000A;<h4 id="errors-if-handler-or-factory-field-not-in-spec">errors if handler or factory field not in spec</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">raises</span><span class="w"> </span><span class="s1">'requires "name" and one of "handler" or "factory" fields'</span><span class="p">,</span><span class="w"> </span><span class="n">f</span></pre>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h4 id="for-activity-with-handler">for activity with handler</h4>&#x000A;&#x000A;<h4 id="calls-activity-handler">calls activity handler</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">handler</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">spy</span><span class="p">.</span><span class="n">new</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w">&#x000A;  </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-activity'</span><span class="w">&#x000A;  </span><span class="ss">handler:</span><span class="w"> </span><span class="n">handler</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">spy</span><span class="p">(</span><span class="n">handler</span><span class="p">).</span><span class="n">was_called</span><span class="w"> </span><span class="mi">1</span></pre>&#x000A;&#x000A;<h4 id="passes-any-extra-args-to-handler">passes any extra args to handler</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">handler</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">spy</span><span class="p">.</span><span class="n">new</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;</span><span class="n">aspec</span><span class="w"> </span><span class="o">=</span><span class="w">&#x000A;  </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-activity'</span><span class="w">&#x000A;  </span><span class="ss">handler:</span><span class="w"> </span><span class="n">handler</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w"> </span><span class="n">aspec</span><span class="p">,</span><span class="w"> </span><span class="s1">'a1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'a2'</span><span class="p">,</span><span class="w"> </span><span class="s1">'a3'</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">spy</span><span class="p">(</span><span class="n">handler</span><span class="p">).</span><span class="n">was_called_with</span><span class="w"> </span><span class="s1">'a1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'a2'</span><span class="p">,</span><span class="w"> </span><span class="s1">'a3'</span></pre>&#x000A;&#x000A;<h4 id="returns-result-of-handler">returns result of handler</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w">&#x000A;  </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-activity'</span><span class="w">&#x000A;  </span><span class="ss">handler:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="s1">'r1'</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'r1'</span><span class="p">,</span><span class="w"> </span><span class="n">result</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h4 id="for-activity-with-factory">for activity with factory</h4>&#x000A;&#x000A;<h4 id="instantiates-facory,-calls-run-method">instantiates facory, calls run method</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">handler</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">spy</span><span class="p">.</span><span class="n">new</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w">&#x000A;    </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-factory'</span><span class="w">&#x000A;    </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;      </span><span class="ss">run:</span><span class="w"> </span><span class="n">handler</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">spy</span><span class="p">(</span><span class="n">handler</span><span class="p">).</span><span class="n">was_called</span><span class="w"> </span><span class="mi">1</span></pre>&#x000A;&#x000A;<h4 id="passes-instantiated-object,-finish-function,-extra-args-to-run">passes instantiated object, finish function, extra args to run</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">args</span><span class="w">&#x000A;</span><span class="n">obj</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ss">run:</span><span class="w"> </span><span class="p">(</span><span class="o">...</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">args</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="o">...</span><span class="p">}</span><span class="w">&#x000A;&#x000A;</span><span class="n">aspec</span><span class="w"> </span><span class="o">=</span><span class="w">&#x000A;  </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-factory'</span><span class="w">&#x000A;  </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">obj</span><span class="w">&#x000A;</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w"> </span><span class="n">aspec</span><span class="p">,</span><span class="w"> </span><span class="s1">'a1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'a2'</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="w"> </span><span class="n">obj</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'function'</span><span class="p">,</span><span class="w"> </span><span class="nb">type</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'a1'</span><span class="p">,</span><span class="w"> </span><span class="n">args</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'a2'</span><span class="p">,</span><span class="w"> </span><span class="n">args</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span></pre>&#x000A;&#x000A;<h4 id="returns-result-passed-in-finish-function">returns result passed in finish function</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">result</span><span class="w">&#x000A;</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w">&#x000A;    </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-factory'</span><span class="w">&#x000A;    </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;      </span><span class="ss">run:</span><span class="w"> </span><span class="p">(</span><span class="n">finish</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">finish</span><span class="p">(</span><span class="s1">'r2'</span><span class="p">)</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'r2'</span><span class="p">,</span><span class="w"> </span><span class="n">result</span></pre>&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id="\\run_after_finish">\\run_after_finish<span class="arg-list">(f)</span></h3>&#x000A;&#x000A;<h4 id="calls-f!-immediately-after-the-current-activity-stack-exits">calls f! immediately after the current activity stack exits</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">nextf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">spy</span><span class="p">.</span><span class="n">new</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w">&#x000A;  </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-activity'</span><span class="w">&#x000A;  </span><span class="ss">handler:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="o">\</span><span class="n">run_after_finish</span><span class="w"> </span><span class="n">nextf</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">spy</span><span class="p">(</span><span class="n">nextf</span><span class="p">).</span><span class="n">was_called</span><span class="w"> </span><span class="mi">1</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id="\\switch_to">\\switch_to<span class="arg-list">(new_command)</span></h3>&#x000A;&#x000A;<h4 id="cancels-current-command-and-runs-new-command,-preserving-text">cancels current command and runs new command, preserving text</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">command_run</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">howl</span><span class="p">.</span><span class="n">command</span><span class="p">.</span><span class="n">run</span><span class="w">&#x000A;</span><span class="n">timer_asap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">howl</span><span class="p">.</span><span class="n">timer</span><span class="p">.</span><span class="n">asap</span><span class="w">&#x000A;</span><span class="n">howl</span><span class="p">.</span><span class="n">timer</span><span class="p">.</span><span class="n">asap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">f</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">f</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">new_run</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">spy</span><span class="p">.</span><span class="n">new</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;</span><span class="n">howl</span><span class="p">.</span><span class="n">command</span><span class="p">.</span><span class="n">run</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">new_run</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">run</span><span class="w">&#x000A;  </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'run-activity'</span><span class="w">&#x000A;  </span><span class="ss">handler:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hello arg'</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="o">\</span><span class="n">switch_to</span><span class="w"> </span><span class="s1">'new-command'</span><span class="w">&#x000A;</span><span class="n">howl</span><span class="p">.</span><span class="n">command</span><span class="p">.</span><span class="n">run</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_run</span><span class="w">&#x000A;</span><span class="n">howl</span><span class="p">.</span><span class="n">timer</span><span class="p">.</span><span class="n">asap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">timer_asap</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">spy</span><span class="p">(</span><span class="n">new_run</span><span class="p">).</span><span class="n">was_called_with</span><span class="w"> </span><span class="s1">'new-command hello arg'</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=".text">.text</h3>&#x000A;&#x000A;<h4 id="cannot-be-set-when-no-running-activity">cannot be set when no running activity</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hello'</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">raises</span><span class="w"> </span><span class="s1">'no running activity'</span><span class="p">,</span><span class="w"> </span><span class="n">f</span></pre>&#x000A;&#x000A;<h4 id="returns-nil-when-no-running-activity">returns nil when no running activity</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="kc">nil</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;&#x000A;<h4 id="updates-the-text-displayed-in-the-command_widget">updates the text displayed in the command_widget</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hello'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'hello'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'bye'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'bye'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;&#x000A;<h4 id="returns-the-text-previously-set">returns the text previously set</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="p">,</span><span class="w"> </span><span class="s1">''</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hi'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'hi'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=".prompt">.prompt</h3>&#x000A;&#x000A;<h4 id="does-not-work-when-no-running-activity">does not work when no running activity</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hello'</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">raises</span><span class="w"> </span><span class="s1">'no running activity'</span><span class="p">,</span><span class="w"> </span><span class="n">f</span></pre>&#x000A;&#x000A;<h4 id="updates-the-prompt-displayed-in-the-command_widget">updates the prompt displayed in the command_widget</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hello'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'hello'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'bye'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'bye'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;&#x000A;<h4 id="returns-the-prompt-previously-set">returns the prompt previously set</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'set'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'set'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id="title">title</h3>&#x000A;&#x000A;<h4 id="is-hidden-by-default">is hidden by default</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">is_false</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">header</span><span class="o">\</span><span class="n">to_gobject</span><span class="o">!</span><span class="p">.</span><span class="n">visible</span></pre>&#x000A;&#x000A;<h4 id="is-shown-and-updated-by-setting-.title">is shown and updated by setting .title</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Nice Title'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'Nice Title'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">indic_title</span><span class="p">.</span><span class="n">label</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">is_true</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">header</span><span class="o">\</span><span class="n">to_gobject</span><span class="o">!</span><span class="p">.</span><span class="n">visible</span></pre>&#x000A;&#x000A;<h4 id="is-hidden-by-setting-title-to-empty-string">is hidden by setting title to empty string</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Nice Title'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">is_true</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">header</span><span class="o">\</span><span class="n">to_gobject</span><span class="o">!</span><span class="p">.</span><span class="n">visible</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">''</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">is_false</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">header</span><span class="o">\</span><span class="n">to_gobject</span><span class="o">!</span><span class="p">.</span><span class="n">visible</span></pre>&#x000A;&#x000A;<h4 id="is-restored-to-the-one-set-by-the-current-interaction">is restored to the one set by the current interaction</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Title 0'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'Title 0'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">indic_title</span><span class="p">.</span><span class="n">label</span><span class="w">&#x000A;&#x000A;  </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="p">.</span><span class="n">title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Title 1'</span><span class="w">&#x000A;    </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'Title 1'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">indic_title</span><span class="p">.</span><span class="n">label</span><span class="w">&#x000A;&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'Title 0'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">indic_title</span><span class="p">.</span><span class="n">label</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id="when-using-both-.prompt-and-.text">when using both .prompt and .text</h3>&#x000A;&#x000A;<h4 id="the-prompt-is-displayed-before-the-text">the prompt is displayed before the text</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'prómpt:'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'téxt'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'prómpt:téxt'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;&#x000A;<h4 id="preserves-text-when-updating-prompt">preserves text when updating prompt</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'héllo:'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'téxt'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'héllo:téxt'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hóla:'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'hóla:téxt'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;&#x000A;<h4 id="preserves-prompt-when-updating-téxt-">preserves prompt when updating téxt </h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'héllo:'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'téxt '</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'héllo:téxt '</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'hóla'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'héllo:hóla'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=")"><span class="arg-list">(clear()</span>)</h3>&#x000A;&#x000A;<h4 id="clears-the-text-only,-leaving-prompt-intact">clears the text only, leaving prompt intact</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'héllo:'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'téxt'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">clear</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'héllo:'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id="when-using-nested-interactions">when using nested interactions</h3>&#x000A;&#x000A;<h4 id="each-interaction-has-independent-prompt-and-text">each interaction has independent prompt and text</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'outer:'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'0'</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'outer:0'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;&#x000A;  </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'inner:'</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'1'</span><span class="w">&#x000A;    </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'outer:0inner:1'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'later:'</span><span class="w">&#x000A;    </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'outer:0later:1'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'outer:0'</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span></pre>&#x000A;&#x000A;<h4 id=".stack_depth-returns-number-of-running-activities">.stack_depth returns number of running activities</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">depths</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;</span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;  </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;    </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;  </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;</span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">depths</span></pre>&#x000A;&#x000A;<h4 id="\\abort_all!-cancels-all-running-activities">\\abort_all! cancels all running activities</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">depths</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;</span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;  </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;    </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;      </span><span class="n">command_line</span><span class="o">\</span><span class="n">abort_all</span><span class="o">!</span><span class="w">&#x000A;      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">depths</span></pre>&#x000A;&#x000A;<h4 id="finishing-any-activity-aborts-all-nested-activities">finishing any activity aborts all nested activities</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">depths</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;</span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">dispatch</span><span class="p">.</span><span class="n">launch</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;    </span><span class="n">p</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">dispatch</span><span class="p">.</span><span class="n">park</span><span class="w"> </span><span class="s1">'command_line_test'</span><span class="w">&#x000A;    </span><span class="n">dispatch</span><span class="p">.</span><span class="n">launch</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;      </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;          </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;          </span><span class="n">dispatch</span><span class="p">.</span><span class="n">resume</span><span class="w"> </span><span class="n">p</span><span class="w">&#x000A;&#x000A;    </span><span class="n">dispatch</span><span class="p">.</span><span class="n">wait</span><span class="w"> </span><span class="n">p</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">depths</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">stack_depth</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">},</span><span class="w"> </span><span class="n">depths</span></pre>&#x000A;&#x000A;<h4 id="\\clear_all!-clears-the-entire-command-line-and-restores-on-exit">\\clear_all! clears the entire command line and restores on exit</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">texts</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'outér:'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'0'</span><span class="w">&#x000A;  </span><span class="n">run_as_handler</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">texts</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="o">\</span><span class="n">clear_all</span><span class="o">!</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">texts</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'innér:'</span><span class="w">&#x000A;    </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'1'</span><span class="w">&#x000A;    </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">texts</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;  </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">texts</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">command_widget</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'outér:0'</span><span class="p">,</span><span class="w"> </span><span class="s1">''</span><span class="p">,</span><span class="w"> </span><span class="s1">'innér:1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'outér:0'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">texts</span></pre>&#x000A;</div>&#x000A;</div>&#x000A;</div>
      <div class='footer text-muted'>
        <a href='/'>
          <img width="50" height="50" class="footer-logo" src="/images/howl.png" />
        </a>
        <div class='footer-follow'>
          <p>
            <a class='twitter-follow-button' data-lang='en' data-show-count='false' href='https://twitter.com/howleditor' rel='me'>
              Follow @howleditor
            </a>
          </p>
          <p>
            <a class='twitter-share-button' data-count='none' data-hashtags='howleditor' data-lang='en' data-text='The Howl Editor, a general purpose, light-weight customizable editor.' data-url='http://howl.io' href='https://twitter.com/share'>
              Tweet
            </a>
          </p>
        </div>
        <div class='footer-blurb'>
          <div>The Howl editor.</div>
          <div>
            Copyright 2012-2016
            <a class='alert-link' href='https://github.com/howl-editor/howl/contributors'>
              The Howl Developers.
            </a>
          </div>
        </div>
      </div>
    </div>
    <script>
      <!-- / GA -->
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-45283282-1', 'howl.io');
      ga('send', 'pageview');
      <!-- / Twitter -->
      !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
      if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
      js.src="//platform.twitter.com/widgets.js";
      fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
    </script>
  </body>
</html>
